package com.kwedding.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.kwedding.dto.app.RequestBrandList;
import com.kwedding.dto.app.ResponseBrandList;
import com.kwedding.dto.app.ResponseBrandSortsList;
import com.kwedding.service.app.BrandService;
import com.kwedding.util.BackJson;
import com.kwedding.util.JsonBackBase;
import com.kwedding.util.LoggerParent;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Controller
@RequestMapping("/rest/brand")
@Api(tags = "品牌")
public class BrandController extends LoggerParent {

	@Autowired
	private BrandService brandService;

	@ApiOperation("获取品牌分类列表")
	@ResponseBody
	@RequestMapping(value = "getBrandSortsList", method = { RequestMethod.POST })
	public JsonBackBase<List<ResponseBrandSortsList>> getBrandSortsList() {
		return BackJson.successObj(brandService.getBrandSortsList());
	}

	@ApiOperation("获取品牌列表")
	@ResponseBody
	@RequestMapping(value = "getBrandList", method = { RequestMethod.POST })
	public JsonBackBase<List<ResponseBrandList>> getBrandList(@RequestBody RequestBrandList brandList) {
		return BackJson.successObj(brandService.getBrandList(brandList));
	}

}
